package com.yeyaomai.dksns.flowis.dao;

import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.mapreduce.GroupByResults;
import org.springframework.data.mongodb.core.mapreduce.MapReduceOptions;
import org.springframework.data.mongodb.core.mapreduce.MapReduceResults;
import org.springframework.data.mongodb.core.query.Query;

import com.yeyaomai.dksns.flowis.domain.flowisdetail.FlowisQueryOrder;
import com.yeyaomai.dksns.flowis.domain.flowisdetail.FlowisStatDetailDTO;

/**
 * 
 * @author dingtao@yeyaomai.com
 */
public interface DetailDao  {
	
	/**
	 * pageNum  第几页
	 * pageSize 每页多少行
	 * orders   排序
	 * criterias 条件
	 * @return 
	 */
	public Page<FlowisStatDetailDTO>  getSplit(FlowisQueryOrder order) ;

	/**
	 * 返回总记录数
	 * @return  
	 */
	public  long getTotalSize(Query query,Class<FlowisStatDetailDTO> document);
	
	/**
	 * 
	 * @param dto
	 * @return
	 */
	public void insert(FlowisStatDetailDTO dto);
	
	/**
	 * 
	 * @param conditionArgs
	 * @return
	 */
	public List<FlowisStatDetailDTO> getLastNumberByCondition(LinkedHashMap<String,String> conditionArgs);
	
	/**
	 * 分组统计
	 * @param mapFunction
	 * @param reduceFunction
	 * @param from
	 * @param to
	 * @return
	 */
	GroupByResults<FlowisStatDetailDTO> groupFlowByTimeAndFunction(String mapFunction,String reduceFunction,String groupType,String from,String to);
	
	/**
	 * 分组统计
	 * @return 
	 */
	public <T> MapReduceResults<T> groupFlowByTimeAndFunction(
			Query query, String map, String reduce, MapReduceOptions options ,Class<T> clas);
	
	/**
	 * 按条件删除
	 * @param query
	 * @param clas
	 */
	public <T> void delete(Query query,Class<T> clas);
}
